package data_structure.包装类;

/**
 *
 */
public class 装箱和拆箱 {
    /*
    int i = 10;
    //装箱操作，新建一个Integer类型对象，将i值放入对象的某个属性中
    Integer ii = Integer.valueOf(i);
    Integer ij = new Integer(i);

    //拆箱操作，将Integer对象中的值取出，放到一个基本数据类型中
    int j = ii.intValue();


     */
    /*
    int i = 10;
    //自动装箱
    Integer ii = i;
    Integer ij = (Integer) i;

    //自动拆箱
    int j = ii;
    int k = (int)ii;
*/

    public static void main(String[] args) {
        Integer a = 127;
        Integer b = 127;

        Integer c = 128;
        Integer d = 128;

        System.out.println(a == b);
        System.out.println(c == d);
    }
}
